<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0" />
		<!--ios是否运行创建快捷启动方式-->
		<meta content="yes" name="apple-mobile-web-app-capable">
		<!--ios顶部通知栏的样式 黑色-->
		<meta content="black" name="apple-mobile-web-app-status-bar-style">
		<!--遇到数字不让转成电话号码格式-->
		<meta content="telephone=no" name="format-detection">
		<script src="js/remstyle.js"></script>
		<link rel="stylesheet" href="assets/mui/css/mui.min.css">
		<link rel="stylesheet" type="text/css" href="common/css/base.css" />
		<link rel="stylesheet" type="text/css" href="css/min_page.css" />
<link rel="stylesheet" type="text/css" href="css/sameInfo.css" />
	<link rel="stylesheet" type="text/css" href="css/material_phone.css" />	
		<script type="text/javascript" src="js/vue.js"></script>
		<script type="application/javascript " src="js/jquery-1.7.2.min.js "></script>
		<script src="layer/layer.js"></script>
		<link rel="stylesheet" type="text/css" href="layer/skin/layer.css" />
		<script src="js/config.js"></script>
		<title>电话编辑</title>
	</head>
	<style>
		
	</style>
	<body>
		<!--顶部-->
		<div class="top">
			<div class="top-one" onclick="javascript :history.back(-1);">
				<span><img src="img_page/right.png"/></span>
			</div>
			<div class="point">
				<img src="img_page/3point.png" />
			</div>
		</div>
		<!--内容列表-->
		<div class="phone_con">
			<div class="phone_list" v-for="v in phone_list" @click="choose_phone($event)">
				<img class="phone_list_bgp" src="img_page/phone_Bagimg.png" v-if="v.template==0"/>
				<img class="phone_list_bgp" src="img_page/phone_Bagimg2.png" v-if="v.template==1"/>
				<div class="phone_list_person">
				<span class="phone_list_name">{{v.name}}</span>
				<span class="phone_list_num">{{v.phone}}</span>
				</div>
			</div>	
		</div>
		<!--底部-->
		<div class="phone_bottom">
		<button onclick="phone_manage()">管理</button>
		<button onclick="new_phone()">新建联系人</button>
		</div>
	</body>
	<script type="text/javascript">
		var aaaa = window.location.href;
		var bbbb = aaaa.substring(aaaa.indexOf('addToTo=') + 8,aaaa.length);
		var phone_list=new Vue({
			el:'.phone_con',
			data:{
				phone_list:[
				]
			},
			created: function() {
				this.getList();
			},
			methods:{
				getList: function() {
					var that = this;
					$.ajax({
						type: "get",
						url: v_url + "/wechat/material/getDirectoryList",
						data: {
							c_user_id:c_user_id
						},
						async: true,
						success: function(res) {
							var list = res.data;
							that.phone_list = list
							console.log(that.phone_list);
						}
					});

				},
				choose_phone:function(obj){
					console.log(v_param)
					var html="<div class='phone_list'>"+$(obj.currentTarget).html()+"</div>"
					if(v_param) {
							$.ajax({
								type: "get",
								url: v_url +"/wechat/singlepage/saveContent",
								data: {
									id: v_param,
									content: html,
									c_user_id:c_user_id
								},
								async: false,
								success: function(res) {
									if(res.code == 200) {
										console.log("保存成功")
										window.location.href = bbbb;
									} else {
										console.log("保存失败")
									}
								}
							});
						}
				}
				
			}
		})
		function phone_manage(){
			window.location.href='material_phone_manage.html?c_user_id='+c_user_id
		}
		function new_phone(){
			window.location.href='material_phone_edit.html?c_user_id='+c_user_id
		}
	</script>
</html>
